package cn.com.huzo.repository.trade.impl;

import cn.com.huzo.model.entities.trade.MasterProductionScheduleLinesEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.trade.MasterProductionScheduleLinesRepository;

/**
 * 产品计划数据访问对象。
 *
 * @author 吴旭
 */
@Repository("MasterProductionScheduleLinesRepository")
public class MasterProductionScheduleLinesRepositoryImpl extends GenericRepositoryImpl<MasterProductionScheduleLinesEntity, String>
        implements MasterProductionScheduleLinesRepository {

    private final String namespace = "cn.com.huzo.repository.trade.MasterProductionScheduleLinesRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public MasterProductionScheduleLinesRepositoryImpl() {
        super(MasterProductionScheduleLinesEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<MasterProductionScheduleLinesEntity> fetchByHeaderKey(Long headerKey) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderKey"), headerKey);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public MasterProductionScheduleLinesEntity fetchByLinesKey(String linesKey) {
        return getSqlSession().selectOne(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByLinesKey"), linesKey);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<MasterProductionScheduleLinesEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<MasterProductionScheduleLinesEntity> itemsList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemsList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer updateLinesForSync(MasterProductionScheduleLinesEntity instance) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "updateLinesForSync"), instance);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
